﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="EntryViewModel.cs" company="Marcin Jastrzebski">
//   Copyright (c) Marcin Jastrzebski (marcin@marcinj.net)
// </copyright>
// <summary>
//   The entry view model.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace mPassRT.ViewModels.Group
{
    using KeePassLib;

    using mPassRT.Utilities;

    /// <summary>The entry view model.</summary>
    public class EntryViewModel : ItemViewModel
    {
        #region Constructors and Destructors

        /// <summary>Initializes a new instance of the <see cref="EntryViewModel"/> class.</summary>
        /// <param name="entry">The entry.</param>
        public EntryViewModel(PwEntry entry)
        {
            this.Entry = entry;
        }

        #endregion

        #region Public Properties

        /// <summary>Gets the entry.</summary>
        public PwEntry Entry { get; private set; }

        /// <summary>Gets the name.</summary>
        public override string Name
        {
            get
            {
                return this.Entry.GetString(PwDefs.TitleField, true);
            }
        }

        /// <summary>Gets the url.</summary>
        public string Url
        {
            get
            {
                return this.Entry.GetString(PwDefs.UrlField, false);
            }
        }

        /// <summary>Gets the user name.</summary>
        public string UserName
        {
            get
            {
                return this.Entry.GetString(PwDefs.UserNameField, false);
            }
        }

        #endregion
    }
}